package com.i3q360.layui.config.ehcache;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import net.sf.ehcache.CacheException;
import net.sf.ehcache.CacheManager;
import net.sf.ehcache.Status;
import net.sf.ehcache.event.CacheManagerEventListener;

public class CustomerCacheManagerEventListener implements CacheManagerEventListener{

	private Logger logger = LoggerFactory.getLogger(getClass());
	private final CacheManager cacheManager;
	
	
	public CustomerCacheManagerEventListener(CacheManager cacheManager){
		this.cacheManager = cacheManager;
	}
	
	@Override
	public void dispose() throws CacheException {
		// TODO Auto-generated method stub
		logger.info("ehcache dispose...");
	}

	@Override
	public Status getStatus() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void init() throws CacheException {
		// TODO Auto-generated method stub
		logger.info("init ehcache...");
	}

	@Override
	public void notifyCacheAdded(String arg0) {
		// TODO Auto-generated method stub
		logger.info("cacheAdd...{}",arg0);
		logger.info(cacheManager.getCache(arg0).toString());
	}

	@Override
	public void notifyCacheRemoved(String arg0) {
		// TODO Auto-generated method stub
		
	}

}
